<?php
final class Controller_Info extends Controller_Security{
    protected function Acquiescent(){
        $action=Route::GetArguments('action');
        if('save'===$action){
            $id=$_POST['id'];
            $data=array(
                'Content'=>$_POST['content']
            );
            if('1'==$id){
                $data['Summary']=$_POST['summary'];
            }
            Database::UpdateRowsByValue('app_info','ID',$id,$data);
            $data=Database::GetRowByValue('app_info','ID',$id);
            Template::Assign('ID',$data['ID']);
            Template::Assign('Title',$data['Title']);
            if('1'==$id){
                Template::Assign('Summary',$data['Summary']);
            }
            Template::Assign('Content',stripslashes($data['Content']));
            Template::Assign('AlertContainerDisplaySwitch','block'); //警告容器
            Template::Assign('AlertContent','修改成功');             //警告内容
            Template::Display('info/edit.html');
        }
        else{
            $id=Route::GetArguments('id');
            $data=Database::GetRowByValue('app_info','ID',$id);
            Template::Assign('ID',$data['ID']);
            Template::Assign('Title',$data['Title']);
            if('1'==$id){
                Template::Assign('Summary',$data['Summary']);
            }
            Template::Assign('Content',stripslashes($data['Content']));
            Template::Assign('AlertContainerDisplaySwitch','none'); //警告容器
            Template::Assign('AlertContent','');                    //警告内容
            Template::Display('info/edit.html');
        }
    }
}
?>